package com.vend.main.splash
import android.os.Bundle
import android.widget.TextView
import com.gyf.immersionbar.ImmersionBar
import com.vend.common.base.BaseActivity
import com.vend.common.mvp.IPresenter
import com.vend.common.mvp.IView
import com.vend.main.R
import com.vend.main.splash.presenter.SplashPresenter
import kotlinx.android.synthetic.main.activity_main_splash.*

/**
 * Created by glendal on 2022/01/25.
 * 启动页的逻辑处理
 */
class SplashActivity : BaseActivity<SplashPresenter>() ,SplashView{
    override fun getContentLayoutId(): Int {
        return R.layout.activity_main_splash
    }

    override fun initView(savedInstanceState: Bundle?) {
        //将所有的逻辑都放到SplashPresenter中去
        mPresenter = SplashPresenter(this,this)
        mPresenter?.start()
    }

    override fun onDestroy() {
        super.onDestroy()
        mPresenter?.stop()
    }

    override fun showTime(str: String) {
       tv_timer.text = str
    }

    override fun getShowTimeView(): TextView {
        return tv_timer
    }

    /**
     * 启动页设置为沉浸式
     */
    override fun initImmersionBar() {
        //设置共同沉浸式样式
        ImmersionBar.with(this).init()
    }
}
interface SplashView: IView{
    //显示倒计时
    fun showTime(str : String);
    //获取倒计时显示的View
    fun getShowTimeView() : TextView
}